package com.example.common;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class R<T> {
    private Integer code;
    private T data;
    private String msg;

    public static <T> R<T>  success() {
        return new R<>(200, null, null);
    }

    public static <T> R<T> success(T data) {
        return new R(200, data, null);
    }

    public static <T> R<T> error(int code, String msg) {
        return new R<>(code, null, msg);
    }

}
